var app = angular.module('copperModule', ['ui.router']);
app.run(function($rootScope, $state, $stateParams) {
  $rootScope.$state = $state;
  $rootScope.$stateParams = $stateParams;
  // console.log($state);
});
app.config(function($stateProvider, $urlRouterProvider) {
  $urlRouterProvider.otherwise('/index');
  $stateProvider
    .state('index', {
      url: '/index',
      views: {
        '': {
          templateUrl: 'tpls/index.html'
        },
        'topbar@index': {
          templateUrl: 'tpls/topbar.html'
        },
        'main@index': {
          templateUrl: 'tpls/home.html'
        },
        'footer@index': {
          templateUrl: 'tpls/footer.html'
        }
      }
    })
    .state('index.about', {
      url: '/about',
      views: {
        'main@index': {
          templateUrl: 'tpls/about.html'
        }
      }
    })
    .state('index.about.intro', {
      url: '/intro',
      templateUrl: 'tpls/intro.html'
    })
    .state('index.about.join', {
      url: '/join',
      templateUrl: 'tpls/join.html'
    })
    .state('index.about.news', {
      url: '/news',
      templateUrl: 'tpls/news.html'
    })
    .state('index.case', {
      url: '/case',
      views: {
        'main@index': {
          templateUrl: 'tpls/case.html'
        }
      }
    })
    .state('index.service', {
      url: '/service',
      views: {
        'main@index': {
          templateUrl: 'tpls/service.html'
        }
      }
    })
    .state('index.medium', {
      url: '/medium',
      views: {
        'main@index': {
          templateUrl: 'tpls/medium.html'
        }
      }
    })
});
